package com.peng.order.dao.repository.impl;

import com.peng.order.dao.mapper.OrderFailMapper;
import com.peng.order.dao.mapper.OrderSuccessMapper;
import com.peng.order.dao.repository.OrderRepository;
import com.peng.order.pojo.po.ChargingBillFailPO;
import com.peng.order.pojo.po.ChargingBillSuccessPO;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Repository;

import java.util.Collections;
import java.util.List;

@Repository
public class OrderRepositoryImpl implements OrderRepository {

    @Autowired
    private OrderSuccessMapper orderSuccessMapper;
    @Autowired
    private OrderFailMapper orderFailMapper;

    @Override
    public Integer saveSuccessOrder(ChargingBillSuccessPO chargingBillSuccessPO) {

        System.out.println("-------------------");
        return orderSuccessMapper.insert(chargingBillSuccessPO);
    }

    @Override
    public Integer saveFailOrder(ChargingBillFailPO chargingBillFailPO) {
        return orderFailMapper.insert(chargingBillFailPO);
    }

    @Override
    public List<ChargingBillSuccessPO> orderList(Integer userId) {
        QueryWrapper<ChargingBillSuccessPO> queryWrapper =
                new QueryWrapper<>();
        queryWrapper.eq("user_id", userId);
        orderSuccessMapper.selectList(queryWrapper);
        return Collections.emptyList();
    }
}
